<script>
import { ref, onBeforeMount } from 'vue';
import { getWeatherList } from '@/apis/weather'; // 确保路径正确

export default {
  setup() {
    const weather = ref({
      header: ['城市', '天气', '温度', '风力'],
      data: [],
      // index: true,
      // columnWidth: [50],
      waitTime: 1000,
      // 表头背景色
      headerBGC: '#FFFFFF',
      // 奇数行背景色
      oddRowBGC: '#FBFBFB',
      // 偶数行背景色
      evenRowBGC: '#FFFFFF',
      align: ['center'],
      // rowNum: 3,
    });

    onBeforeMount(async () => {
      const weatherRes = await getWeatherList();
      weather.value.data = weatherRes.data;
    });

    return {
      weather
    };
  }
};
</script>

<template>
  <dv-scroll-board :config="weather" style="color: #37474F; width: 100%; height: 100%; border-radius: 3px !important; overflow: hidden;" />
</template>